package com.yy.utils;

import org.apache.commons.codec.binary.Base64;

/**
 * base64编码
 * @author Lenovo
 *
 */
public class Base64Util {
	
	/**
     * Base64加密
     * @param key
     * @return
     */
    public static String encode(String key){
        byte[] bt = key.getBytes();
        return (new Base64().encodeToString(bt));
    }

    /**
     * Baes64解密
     * @param key
     * @return
     */
    public static String decode(String key){
        byte[] bt = new Base64().decode(key);
        return new String(bt);
    }

	  /*public static void main(String[] args) { System.out.println(encode("admin"));
	  }*/
}
